package com.project.blog.controller;

import com.project.blog.entity.User;
import com.project.blog.mapper.UserMapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
@Api(tags="测试模块")
@RestController
public class TestController {

    @Autowired
    private UserMapper userMapper;
    @ApiOperation(value = "测试", notes="测试")
    @GetMapping("/test")
    public String test(@RequestParam("test") String test) {
        return "111当前接收的参数的值为111：" + test;
    }

    @ApiOperation(value = "用户信息列表", notes="用户信息列表 。。。")
    @GetMapping("list")
    public List<User> list(){
        return userMapper.selectList(null);
    }

    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "用户ID", dataType = "string", paramType = "query", required = true, defaultValue = "1") })
    @GetMapping("test2")
    @ApiOperation(value = "测试", notes="测试")
    public List<User> test2(@RequestParam("id") String id ){
        return userMapper.selectList(null);
    }


}
